package model

import (
	"video-management-system/userrpc/userrpc"

	"gorm.io/gorm"
)

type CollectionInfo struct {
	gorm.Model
	Uid           int    `gorm:"type:int"`
	Vid           int    `gorm:"type:int"`
	CollectStatus string `gorm:"type:enum('0','1');default:'0';not null"`
}

func (i *CollectionInfo) CollectAdd(db *gorm.DB) error {
	return db.Debug().Create(i).Error
}

func (i *CollectionInfo) FindCollectById(db *gorm.DB, in *userrpc.CollectDelRequest) error {
	return db.Debug().Where("uid=?", in.Uid).Where("vid=?", in.Vid).Find(i).Error
}
